//
//  TopDJView.m
//  KuWoCan
//
//  Created by LiBenCan on 17/6/16.
//  Copyright © 2017年 hwd. All rights reserved.
//

#import "TopDJView.h"

@implementation TopDJView

-(void)addTopViewDataDic:(NSDictionary *)dataDic
{
    
    self.backgroundColor = [UIColor colorWithHexString:@"#469ce4"];
    //返回按钮
    _leftBTn = [UIButton buttonWithType:UIButtonTypeCustom];
    _leftBTn.frame = CGRectMake(0,10,80,54);
    [_leftBTn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [_leftBTn setImageEdgeInsets:UIEdgeInsetsMake(15,10,10,40)];
    [self addSubview:_leftBTn];
    
    
    UILabel *nameLab = [TomamaUI createLabel:CGRectMake(100*screenW_6,15*screenW_6,SCREENW-200*screenW_6,45*screenW_6) textAligment:1 font:[UIFont systemFontOfSize:20*screenW_6] textColor:[UIColor whiteColor] text:[NSString stringWithFormat:@"%@",@"我的等级"]];
    [self addSubview:nameLab];
    
    
    UIImageView *headerImageV = [TomamaUI createImageView:CGRectMake(SCREENW/2-45*screenW_6,70*screenW_6,90*screenW_6, 65*screenW_6) backGroundImageV:dataDic?dataDic[@"level"]:@"huiyuan"];
    [self addSubview:headerImageV];
    
    if (!dataDic) {
        headerImageV.frame = CGRectMake(SCREENW/2-35*screenW_6,80*screenW_6,70*screenW_6,50*screenW_6);
    }

    
    NSArray *titleArr = [[NSArray alloc]initWithObjects:@"经济指标",@"综合评定",@"信誉等级",nil];
    NSArray *titleArr2 = [[NSArray alloc]initWithObjects:@"economics",@"comprehensive",@"credit",nil];
    
    for (int i = 0; i<3; i++) {
        
        UILabel *topLab = [TomamaUI createLabel:CGRectMake(SCREENW/3*i,155*screenW_6,SCREENW/3,20*screenW_6) textAligment:1 font:[UIFont systemFontOfSize:15*screenW_6] textColor:[UIColor whiteColor] text:[NSString stringWithFormat:@"%@分",dataDic[titleArr2[i]]?dataDic[titleArr2[i]]:@"0"]];
        [self addSubview:topLab];
        
        UILabel *bottomLab = [TomamaUI createLabel:CGRectMake(SCREENW/3*i,CGRectGetMaxY(topLab.frame)+5*screenW_6,SCREENW/3-1,20*screenW_6) textAligment:1 font:[UIFont systemFontOfSize:15*screenW_6] textColor:[UIColor whiteColor] text:titleArr[i]];
        [self addSubview:bottomLab];
        
        if (i>=1) {
            [self addSubview:[ToolViewViewController addLineLab:CGRectMake(SCREENW/3*i-1,165*screenW_6,1, 20*screenW_6)]];
        }
        
    }
    
}

@end
